﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Net.Fan.SmallPig.DataAccess;
using System.Data;

public partial class Comm_MyWorks : System.Web.UI.Page
{


    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            HyperLinkReflash.NavigateUrl = Request.RawUrl;
        }
        string jobType = Request.Params["T"];
        if (string.IsNullOrEmpty(jobType))
        {
            jobType = "MY";
        }
        jobType = jobType.Trim().ToUpper();
        DataTable jobs = null;
        switch (jobType)
        {
            case "MY":
                {
                    if (IsPostBack == false)
                    {
                        LabelTitle.Text = "待我处理的单据";
                        jobs = JobDA.GetWhoesJobs(this.User.Identity.Name);
                        //GridView1.DataSource = jobs;
                        //GridView1.DataBind();
                    }
                    break;
                }
            case "NOFINISH":
                {
                    if (IsPostBack == false)
                    {
                        LabelTitle.Text = "未完工的单据";
                        jobs = JobDA.GetAllNoFinishedJobs();
                    }
                    break;
                }
            case "OVERDUE":
                {
                    if (IsPostBack == false)
                    {
                        LabelTitle.Text = "逾期的单据";
                        jobs = JobDA.GetOverdueJobs();
                    }
                    break;
                }
            case "DUESOON":
                {
                    if (IsPostBack == false)
                    {
                        LabelTitle.Text = "快到期的单据";
                        jobs = JobDA.GetDueSoonJobs();
                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
        JobGridView1.Jobs = jobs;
    }
}
